<?php
	/**
	 * Strored procedures generator
	 */
	class DBGenerator
	{
		public $engine;
		
		/**
		 * Class conctructor
		 *
		 */
		function __construct()
		{
			global $object;
			$driver = $object->config->db_config_default[driver];
			include_once(SPANEL.SEPARATOR."classes".SEPARATOR.$driver."Generator.php");
			$engine_type = $driver.'Generator';
			$this->engine = new $engine_type();
		}
		
		/**
		 * Generates stored procedures
		 *
		 * @param array $data necessary data
		 */
		function GenerateStoredProcedures($data)
		{
			$procedure_string = $this->engine->GenerateStoredProcedures($data);
			return $procedure_string;
		}

		/**
		 * Creates/compiles stored procedures
		 *
		 * @param array $data necessary data
		 */
		function CreateStoredProcedures($data)
		{
			$this->engine->CreateStoredProcedures($data);
		}		
		
		public function InsertSystemData($data)
		{
			$this->engine->InsertSystemData($data);
		}
	}
?>